# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=gitrob
pkgver=7.7be4c53
pkgrel=3
groups=('blackarch' 'blackarch-scanner')
pkgdesc='Reconnaissance tool for GitHub organizations.'
arch=('x86_64' 'aarch64')
url='http://michenriksen.com/blog/gitrob-putting-the-open-source-in-osint/'
license=('custom:unknown')
depends=('glibc')
makedepends=('git' 'go-pie')
options=('!strip')
source=("git+https://github.com/michenriksen/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

build() {
  # Repo is unmaintained (archived), does not accept the new build process
  mkdir -p "src/$url" && rm -rf "src/$url" && mv $pkgname "src/$url" &&
    cd "src/$url"

  GOPATH="$srcdir" go get -d -t $url
}

package() {
  install -dm 755 "$pkgdir/usr/bin"

  GOPATH="$srcdir" go build -v $url

  install -Dm 755 "$srcdir/gitrob-putting-the-open-source-in-osint" \
    "$pkgdir/usr/bin/$pkgname"
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" \
    "src/$url/README.md" "src/$url/CHANGELOG.md"
  install -Dm 644 "src/$url/LICENSE.txt" \
    "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

